using System;
using System.Collections.Generic;
using System.Text;
using MagicAttributeTest.Abilities;

namespace MagicAttributeTest
{
  public class CreatureCard : StaticCard
  {
    CreatureCard(string name, string subType1, string subType2, string sMana, int power, int toughness)
    {
      Init(name, Type.Creature, sMana, power, toughness);
      if (subType1.Length > 0)
        SubTypes.Add(new Type(subType1));
      if (subType2.Length > 0)
        SubTypes.Add(new Type(subType2));
    }
  }

  public class Bonesplitter : StaticCard
  {
    public Bonesplitter()
    {
      Init("Bonesplitter", Type.Artifact, "1");
    }
  }
  public class RagingGoblin : StaticCard
  {
    public RagingGoblin()
    {
      Init("Raging Goblin", Type.Creature, "r", 1, 1);
      SubTypes.Add(new Type("Goblin"));
      AddAbility(new HasteAbility());
    }
  }
  public class AncientSilverback : StaticCard
  {
    public AncientSilverback()
    {
      Init("Ancient Silverback", Type.Creature, "1111gg", 6, 5);
      SubTypes.Add(new Type("Gorilla"));
      AddAbility(new RegenerationAbility(new Mana("g")));
    }
  }
  public class LightningBolt : StaticCard
  {
    public LightningBolt()
    {
      Init("Lightning Bolt", Type.Instant, "r");
    }

    public override void PlayFromHand(StackItem Context)
    {
      MagicSelector selector = new MagicSelector();
      MagicSelectItem item = new MagicSelectItem();
      item.SetCount(1);
      item.Targets.Add(ETarget.Creature);
      item.Targets.Add(ETarget.Player);
      selector.Add(item);
      Global.Select(selector);
      Context.Targets = selector.Targets;
    }

    public override void FromStackSuccess(StackItem Context)
    {
      Global.CheckTargetLegality(Context.Targets);
      EffectCall eCall = new EffectCall();
      eCall.method = MagicMethod.OnDamage;
      eCall.parameter = new Damage(3, CastingCosts.ManaCosts, Context.Invoker);
      eCall.obj = Context.Targets;
      Global.Resolve(eCall);
    }
  }

  public class GiantGrowth : StaticCard
  {
    public GiantGrowth()
    {
      Init("Giant Growth", Type.Instant, "g");
    }

    public override void FromStackSuccess(StackItem Context)
    {
      //Targets = new MagicObject[] { t };
      //Source = s;
      Global.CheckTargetLegality(Context.Targets);
      Effect effect = new ChangeStrengthToughness(3, 3);
      effect.AddToCard((MagicPermanent)Context.Targets.TargetOne);
    }
  }
  public class LandCard : StaticCard 
  {
    protected LandCard() { }
    public LandCard(string name, string SuperType, string SubType, char SingleMana)
    {
      Init(name, Type.Land, "");
      if (SuperType.Length > 0)
        SuperTypes.Add(new Type(SuperType));
      if (SubType.Length > 0)
        SubTypes.Add(new Type(SubType));
      AddAbility(new ManaAbility(SingleMana.ToString()));
    }
  }
}
